//卡劵管理-充值列表
App.util.ns('Admin.Card.Recharge');
App.pages.add((function(){
    var NS = Admin.Card.Recharge;
    var page = new App.Page({
        name: 'card/recharge/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-credit-card"></i>',
            content: '卡劵管理'
        }, {
            content: '充值列表'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/card/recharge',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                showId: false,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'timeRange'},
                {type: 'select', name: 'status', title: '是否充值', width: '80px', items: [
                    [1, '未充值'],
                    [2, '已充值'],
                ]}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.card.recharge.create'},
                {parent: 'view', permission: 'op:admin.card.recharge.detail'},
                {parent: 'edit', permission: 'op:admin.card.recharge.update',conditions: [['status', '1']]},
                {type: 'inline', permission: 'op:admin.card.recharge.rechargecard',
                    name: '充值', operation: {type: 'change', url: 'rechargecard'},
                    conditions: [['status', '1']]
                },
                {parent: 'drop', permission: 'op:admin.card.recharge.delete'},
                {parent: 'multiDrop', permission: 'op:admin.card.recharge.multiDelete'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form)
                }
            },
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());